<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<%@ taglib prefix="s" uri="/struts-tags" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>欢迎登陆轻松办公系统</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/libs/jquery/1.6/jquery.min.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
        <link rel="stylesheet" href="${pageContext.request.contextPath}/css/min.css" />
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/min.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/content/settings/main.js"></script>
	 	<link rel="stylesheet" href="${pageContext.request.contextPath}/content/settings/style.css" />
	 	<script language="javascript" src="${pageContext.request.contextPath}/script/jquery_treeview/jquery.treeview.js"></script>
		<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/style/blue/file.css" />
		<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/script/jquery_treeview/jquery.treeview.css" />
	  	<script type="text/javascript">
			$(function(){
				// 指定事件处理函数
				$("[name=powerIds]").click(function(){
					// 当选中或取消一个权限时，也同时选中或取消所有的下级权限
					$(this).siblings("ul").find("input").attr("checked", this.checked);
					//$(this).attr();
					// 当选中一个权限时，也要选中所有的直接上级权限
					if(this.checked == true){
						$(this).parents("li").children("input").attr("checked", true);
					}
				});
			});
		</script>
		<style type="text/css">
			body{background: url("img/bg.png");}
		</style>
</head>
<body>
  <div class="settings" id="settings">
        <div class="wrapper">
            <div class="grid3">
                <div class="titre">背景色</div>
                <a href="url(${pageContext.request.contextPath}/css/img/bg.html" class="backgroundChanger active" title="White"></a>
                <a href="url(${pageContext.request.contextPath}/css/img/dark-bg.html" class="backgroundChanger dark" title="Dark"></a>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
        </div>
        <a class="settingbutton" href="#"></a>
    </div>        
        <!--              
                HEAD
         --> 
        <!--==================================登录头部分显示的部分（信息）============================================-->
        <div id="head">
            <div class="left">
                <a href="#" class="button profile"><img src="img/icons/top/huser.png" alt="" /></a>
                	你好：
                <a href="#">${sessionScope.user1.user_loginName }</a>
                &nbsp;||&nbsp;
                <a href="${pageContext.request.contextPath}/userAction_logout" onclick="return confirm('确定注销系统吗？')">注销</a>
            </div>
            <div class="right">
                <form action="#" id="search" class="search placeholder">
                    <label>你要找的东西 ?</label>
                    <input type="text" value="" name="q" class="text"/>
                    <input type="submit" value="rechercher" class="submit"/>
                </form>
            </div>
        </div>
        <!--            
                SIDEBAR
        --> 
        <!--=============================== 左侧要显示的数据（菜单）====================================  -->
        <div id="sidebar">
        	<ul>
        		<li>
        			<a href="${pageContext.request.contextPath }/index.jsp"><img src="${pageContext.request.contextPath }/img/icons/menu/home.png" alt="" />返回首页</a>
        		</li>
      			<s:iterator value="#application.topPowerList">
	      			<s:if test="#session.user1.hasPowerByName(power_name)">
		       			<li>
		       			<a href="#"><img src="${pageContext.request.contextPath}/img/icons/menu/${power_name }.png" alt="" />${power_name }</a>
		                    <ul>
		                    	<s:iterator value="power_children">
			                    	<s:if test="#session.user1.hasPowerByName(power_name)">
			                        		<li>
			                        			<a href="${pageContext.request.contextPath }${power_url }">${power_name }</a>
			                        		</li>
			                        </s:if>
		              			</s:iterator>
		                    </ul>
		                 </li>
		            </s:if>
	            </s:iterator>
        	</ul>
        </div>     
        <!--            
              CONTENT 
         --> 
          <!-- ===================================中间显示的部分（主体）========================================= -->
		
		<div id="content" class="white">
			   <div class="bloc">
			   <div class="title"></div>
			    <div class="content dashboard">
			        <div class="center" style="text-align: center;">
			            <a href="linkAction_list" class="shortcut">
			                <img src="img/contact.png" alt="" width="48" height="48"/>
			                通讯录
			            </a>
			            <a href="usermarkAction_list?unique_id=${sessionScope.user1.unique_id }" class="shortcut last">
			                <img src="img/page.png" alt="" width="48" height="48" />
			                我的便签
			            </a>
			            <a href="forum_queryAllForum.action?type=0" class="shortcut">
			                <img src="img/baohu.ico" alt="" width="48" height="48" />
			                论坛板块
			            </a>
			            <a href="applicationAction_list" class="shortcut">
			                <img src="img/rutun.ico" alt="" width="48" height="48" />
			                起草申请
			            </a>
			            <a href="applicationAction_myApplicationList" class="shortcut last">
			                <img src="img/liuchen.ico" alt="" width="48" height="48" />
			                申请列表
			            </a>
			            <a href="applicationAction_myTaskList" class="shortcut last">
			                <img src="img/icon.png" alt="" width="48" height="48" />
			                待我审批
			            </a>
			            <a href="#" class="shortcut last">
			                <img src="img/dep.ico" alt="" width="48" height="48" />
			                我的邮件
			            </a>
			            <a href="#" class="shortcut last">
			                <img src="img/user.ico" alt="" width="48" height="48" />
			                我的任务
			            </a>
			            <div class="cb"></div>
			        </div>
			        <p></p>
			    </div>
			</div>  
		    <div class="notif info bloc">
		        	  正在为【${requestScope.post1.post_name}】设置权限
		    </div>
		        <form action="${pageContext.request.contextPath}/postAction_setPower" method="post">
		            <input type="hidden" name="unique_id" value="${post1.unique_id }">
					<ul id="tree">
					<s:iterator value="#application.topPowerList">
						<li>
							<input type="checkbox" name="powerIds" value="${unique_id}" id="cb_${unique_id}" <s:property value="%{unique_id in powerIds ? 'checked' : ''}"/> />
							<label for="cb_${unique_id}" style="font-size:16px; font-weight: bolder;color: #009933;">
							<span class="folder">${power_name}</span>
							</label>
							<ul>
							<s:iterator value="power_children">
								<li>
									<input type="checkbox" name="powerIds" value="${unique_id}" id="cb_${unique_id}" <s:property value="%{unique_id in powerIds ? 'checked' : ''}"/> />
									<label for="cb_${unique_id}" style="font-size:14px;font-weight: bolder;color:#336699;">
									<span class="folder">${power_name}</span>
									</label>
									<ul>
									<s:iterator value="power_children">
										<li>
											<input type="checkbox" name="powerIds" value="${unique_id}" id="cb_${unique_id}" <s:property value="%{unique_id in powerIds ? 'checked' : ''}"/> />
											<label for="cb_${unique_id}"  style="font-size:12px;font-weight: bolder;color: #6699CC;">
												<span class="folder">${power_name}</span>
											</label>
										</li>
									</s:iterator>
									</ul>
								</li>		
							</s:iterator>
							</ul>
						</li>
					</s:iterator>
					</ul>
		     		<div class="submit notif  bloc" style="text-align: center;">
		        		<input type="submit" value="提交" />
		        		<input type="button" onclick="javascript:history.go(-1)" value="取消" class="black"/>
		   	 		</div>
				</form>
		</div>    
		<script language="javascript">
			$("#tree").treeview().close();
		</script>
</body>
</html>